package com.example.mqproduct.job;

import lombok.extern.log4j.Log4j2;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Log4j2
//@Component
public class TestJob {

    @Scheduled(cron = "0/5 * * * * ?")
    public void test() {
        StackTraceElement[] elements = new RuntimeException()
                .getStackTrace();


        for (StackTraceElement e : elements) {
//            log.info(e.getMethodName());
            if ("main".equals(e.getMethodName())) {
                log.info("main方法的调用类是%s", e.getClassName());
            }
        }
    }
}
